<?php


namespace Xiaoguai\DesignPattern\DP013\Leaf;


use Xiaoguai\DesignPattern\DP013\Component;

class Leaf implements Component
{
    /**
     * @var $name string
     */
    public $name;

    public function __construct(string $name)
    {
        $this->name = $name;
    }

    public function add(Component $component): void
    {
        // TODO: Implement add() method.
    }

    public function remove(Component $component): void
    {
        // TODO: Implement remove() method.
    }

    public function getChild(int $depth): Component
    {
        return null;
    }

    public function operation()
    {
        echo 'leaf: ' . $this->name . ': 被访问';
    }
}